package com.eshop.exception;

import org.springframework.util.StringUtils;

public class EntityNotFoundException extends RuntimeException
{
    public EntityNotFoundException(final Class clazz, final String field, final String val) {
        super(generateMessage(clazz.getSimpleName(), field, val));
    }
    
    private static String generateMessage(final String entity, final String field, final String val) {
        return StringUtils.capitalize(entity) + " with " + field + " " + val + " does not exist";
    }
}
